<?php

/**
 * This is the model class for table "autoresponder_wemail".
 *
 * The followings are the available columns in table 'autoresponder_wemail':
 * @property integer $id
 * @property integer $user_id
 * @property integer $country_id
 * @property string $subject
 * @property string $body
 * @property string $email
 * @property string $password
 * @property string $protocal
 * @property string $server
 * @property string $port
 * @property string $status
 * @property string $value1
 * @property string $value2
 */
class AutoresponderWemail extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return AutoresponderWemail the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'autoresponder_wemail';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('email', 'required'),
			array('user_id, country_id', 'numerical', 'integerOnly'=>true),
			array('subject', 'length', 'max'=>5000),
			array('email, password', 'length', 'max'=>256),
			array('protocal, server, port', 'length', 'max'=>255),
			array('status', 'length', 'max'=>1),
			array('value1', 'length', 'max'=>124),
			array('value2', 'length', 'max'=>123),
			array('body', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, user_id, country_id, subject, body, email, password, protocal, server, port, status, value1, value2', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'user_id' => 'User',
			'country_id' => 'Country',
			'subject' => 'Subject',
			'body' => 'Body',
			'email' => 'Email',
			'password' => 'Password',
			'protocal' => 'Protocal',
			'server' => 'Server',
			'port' => 'Port',
			'status' => 'Status',
			'value1' => 'Value1',
			'value2' => 'Value2',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('user_id',$this->user_id);
		$criteria->compare('country_id',$this->country_id);
		$criteria->compare('subject',$this->subject,true);
		$criteria->compare('body',$this->body,true);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('password',$this->password,true);
		$criteria->compare('protocal',$this->protocal,true);
		$criteria->compare('server',$this->server,true);
		$criteria->compare('port',$this->port,true);
		$criteria->compare('status',$this->status,true);
		$criteria->compare('value1',$this->value1,true);
		$criteria->compare('value2',$this->value2,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}